Skip to content

Animate the indeterminate progress bar with Core Animation - #1187

Merged
onevcat merged 1 commit into
mainfrom
perf/progress-indicator-animation
Dec 2, 2026
Merged

onevcat merged 1 commit into
mainfrom
perf/progress-indicator-animation

Conversation

@onevcat

@onevcat onevcat commented Dec 1, 2026 •

Copy link
Copy Markdown
Owner

Problem

A progress report without a value (OSC 9;4;3) shows a sliding strip at the top of the pane. A SwiftUI phaseAnimator moved it, so the app updated the view graph on the main thread for each display frame while the report was active. Found during the investigation of #1186. This change does not address the Invalid window messages in that issue.

Change

  • Core Animation moves the strip in the render server (GhosttyIndeterminateProgressBar). The width, speed, easing, and colors are the same.
  • The animation is limited to 30 fps. WindowServer cost follows the frame rate, not the size of the strip: without the limit, Core Animation alone did not reduce it.
  • A resize keeps the animation phase.
  • With Reduce Motion, the bar is static. Before, it ignored this setting.

Measurements

Debug builds, one working pane, all indicators on, CPU over 20 s, two runs each, window in front.

Prowl WindowServer (idle baseline)
macOS 27.2, 1080p: before 18–19% 42% (2–3%)
macOS 27.2, 1080p: after 0.5% 27–29% (2–4%)
macOS 27.0.1, 5K + 4K: before 22–24% 33–34% (16–17%)
macOS 27.0.1, 5K + 4K: after 0.8–0.9% 25–27% (16–17%)

The "before" rows and the "before" video are from an experimental build that could select the original phaseAnimator. The "after" row for 27.0.1 is from the same build with the same Core Animation settings. The "after" row for 27.2 is from this branch.

The rest of the WindowServer cost is mainly from the two system spinners (tab and sidebar row): about 25–27% on 27.2 without the bar.

Verification

  • make check, make build-app, and make test pass. New tests cover travel, resize, Reduce Motion, and empty width.
  • Checked in a Debug app: sliding, determinate, error, and paused states; split resize; tab switch and return.

Before:

before.mp4

After:

after.mp4

States (sliding, 40%, error, paused, sliding again):

states

The SwiftUI phase animator updated the view graph on the main thread for each display frame while an agent worked. Core Animation moves the strip in the render server, and a 30 fps limit reduces the WindowServer cost.
@onevcat
onevcat merged commit 8d0b2eb into main Dec 2, 2026
2 checks passed
@onevcat
onevcat deleted the perf/progress-indicator-animation branch December 2, 2026 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant